home *** CD-ROM | disk | FTP | other *** search
/ Animation How-To / Animation How-to CD.iso / PLY / CHAPTER4 / JELLYDIM / JELLYDIM.BAS < prev    next >
BASIC Source File  |  1994-01-01  |  3KB  |  133 lines

  1. ' JELLYDIM.BAS
  2. ' Jellyfish Diamond Motion File
  3.  
  4. TYPE vector
  5.   x AS SINGLE
  6.   y AS SINGLE
  7.   z AS SINGLE
  8. END TYPE
  9.  
  10. pi = 3.1415926536#
  11. radians = 180 / pi
  12.  
  13. DIM vertex(42) AS vector, triangle(3) AS vector
  14. DIM red(16), green(16), blue(16)
  15. pref$ = "\ply\dat\jellydim\diam"
  16.  
  17. ' set the screen up with pretty rainbow colors
  18.  
  19. SCREEN 12
  20.  
  21. zoom = .015
  22. xoff = 320
  23. yoff = 240
  24.  
  25. WINDOW ((0 - xoff) * zoom, (0 - yoff) * zoom)-((639 - xoff) * zoom, (479 - yoff) * zoom)
  26.  
  27. FOR y = 1 TO 4
  28.     FOR x = 1 TO 4
  29.          colornum = x + ((y - 1) * 4) - 1
  30.          READ red(colornum), green(colornum), blue(colornum)
  31.          KOLOR = 65536 * blue(colornum) + 256 * green(colornum) + red(colornum)
  32.          PALETTE colornum, KOLOR
  33.          COLOR colornum
  34.     NEXT x
  35. NEXT y
  36.  
  37.  
  38. 'Rainbow Palette
  39.  
  40. DATA  0,  0,  0
  41. DATA 32,  0,  0
  42. DATA 42,  0,  0
  43. DATA 58, 16,  0
  44. DATA 63, 32,  0
  45. DATA 58, 56,  0
  46. DATA 16, 42,  0
  47. DATA  0, 30, 36
  48. DATA  0, 20, 40
  49. DATA  0, 10, 48
  50. DATA  0,  0, 63
  51. DATA 20,  0, 53
  52. DATA 23,  0, 29
  53. DATA 19,  7, 17
  54. DATA 50, 40, 45
  55. DATA 63, 63, 63
  56.  
  57. pi = 3.1415926535#
  58. rad = pi / 180
  59.  
  60. radius1 = 1
  61. radius2 = 1.4
  62. radius3 = 1.8
  63. radius4 = .7
  64. radius5 = .01
  65.  
  66. ht1 = 1
  67. ht2 = .8
  68. ht3 = .5
  69. ht4 = -.5
  70. ht5 = -1
  71.  
  72. masteramp = 1.3
  73.  
  74. ampl1 = .03 * masteramp
  75. ampl2 = .02 * masteramp
  76. ampl3 = .01 * masteramp
  77. ampl4 = .04 * masteramp
  78. ampl5 = .05 * masteramp
  79.  
  80. phase = 80   'hump phase
  81.  
  82. phase1 = 0
  83. phase2 = 25
  84. phase3 = 50
  85. phase4 = 75
  86. phase5 = 87
  87.  
  88. aspect = .1  ' control the size of the ellipses in the simplified model
  89. bump = 1
  90. wave = 4
  91.  
  92. DO WHILE INKEY$ = ""
  93.   ang = ang + 10
  94.   height1 = ht1 + ampl1 * (wave * COS(rad * (ang - phase1)) + EXP(bump * (1 + COS((ang - phase - phase1) * rad))))
  95.   height2 = ht2 + ampl2 * (wave * COS(rad * (ang - phase2)) + EXP(bump * (1 + COS((ang - phase - phase2) * rad))))
  96.   height3 = ht3 + ampl3 * (wave * COS(rad * (ang - phase3)) + EXP(bump * (1 + COS((ang - phase - phase3) * rad))))
  97.   height4 = ht4 + ampl4 * (wave * COS(rad * (ang - phase4)) + EXP(bump * (1 + COS((ang - phase - phase4) * rad))))
  98.   height5 = ht5 + ampl5 * (wave * COS(rad * (ang - phase5)) + EXP(bump * (1 + COS((ang - phase - phase5) * rad))))
  99.  
  100.   newradius1 = radius1 * height1
  101.   newradius2 = radius2 * height2 * 1.3
  102.   newradius3 = radius3 * height3 * 2
  103.   newradius4 = radius4 * (1.5 + height4)
  104.   newradius5 = radius5
  105.  
  106.   CIRCLE (0, h1old), r1old, 0, , , aspect
  107.   CIRCLE (0, h2old), r2old, 0, , , aspect
  108.   CIRCLE (0, h3old), r3old, 0, , , aspect
  109.   CIRCLE (0, h4old), r4old, 0, , , aspect
  110.   CIRCLE (0, h5old), r5old, 0, , , aspect
  111.  
  112.   CIRCLE (0, height1), newradius1, 2, , , aspect
  113.   CIRCLE (0, height2), newradius2, 3, , , aspect
  114.   CIRCLE (0, height3), newradius3, 4, , , aspect
  115.   CIRCLE (0, height4), newradius4, 5, , , aspect
  116.   CIRCLE (0, height5), newradius5, 6, , , aspect
  117.                                          
  118.   h1old = height1
  119.   h2old = height2
  120.   h3old = height3
  121.   h4old = height4
  122.   h5old = height5
  123.  
  124.   r1old = newradius1
  125.   r2old = newradius2
  126.   r3old = newradius3
  127.   r4old = newradius4
  128.   r5old = newradius5
  129.  
  130. LOOP
  131.  
  132.  
  133.